package Test;

import java.util.HashMap;
import java.util.Iterator;

public class Test3 {
    /**
     *
     * @param arr int整型一维数组 the array
     * @return int整型
     */
    public int findNum (int[] arr) {
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < arr.length; i++) {
            if (map.containsKey(arr[i])) {
                map.put(arr[i], map.get(arr[i]) + 1);
            } else {
                map.put(arr[i], 1);
            }
        }
        Iterator<Integer> iterator = map.keySet().iterator();
        Integer key;
        while (iterator.hasNext()) {
            key = iterator.next();
            if (arr.length / 2 < map.get(key)) {
                System.out.println(map.get(key));
            }
        }
        return 0;
    }
}
